package com.zuowei.ycy.user.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.and.yzy.frame.adapter.CommonAdapter;
import com.and.yzy.frame.adapter.ViewHolder;
import com.zuowei.ycy.R;
import com.zuowei.ycy.user.domain.ShouZhiInfo;

import java.util.List;

/**
 * Created by admin on 2016/4/20.
 * 收支明细列表
 */
public class ShouzhiAdapter extends CommonAdapter<ShouZhiInfo> {
    public ShouzhiAdapter(Context context, List<ShouZhiInfo> mList, int itemLayoutId) {
        super(context, mList, itemLayoutId);
    }

    @Override
    public void convert(ViewHolder holder, ShouZhiInfo item, int positon) {
        if (positon == getCount()) {
            holder.getView(R.id.view_line).setVisibility(View.GONE);
        } else {
            holder.getView(R.id.view_line).setVisibility(View.VISIBLE);
        }

        holder.setTextViewText(R.id.tv_titile, item.getTitle());
        holder.setTextViewText(R.id.tv_content, item.getContent());
        TextView tvMoney = holder.getView(R.id.tv_money);
        if (item.getSymbol().equals("0")) {
            tvMoney.setText("+" + item.getMoney());
            tvMoney.setTextColor(mContext.getResources().getColor(R.color.text_orange));
        } else {
            tvMoney.setText("-" + item.getMoney());
            tvMoney.setTextColor(mContext.getResources().getColor(R.color.black_gray));
        }
    }
}
